package com.justonetech.translation.domain.base;

import com.justonetech.system.domain.SysDept;
import com.justonetech.system.domain.SysPerson;
import com.justonetech.translation.domain.Contract;
import com.justonetech.translation.domain.Project;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;

import java.io.Serializable;


/**
 * This is an object that contains data related to the contract table.
 * Do not modify this class because it will be overwritten if the configuration file
 * related to this class is modified.
 * TableComment : 合同
 * SyncTemplatepatterns : list\w*
 * SyncDao : false
 * TableName : 合同
 * SyncBoolean : get
 * SyncJsp : true
 * Treeable : false
 * Projectable : true
 *
 * @hibernate.class
 *  table="contract"
 */
@JsonIgnoreProperties(value={"hibernateLazyInitializer"})
public abstract class BaseContract  implements Serializable{

	public static String REF = "Contract";
	public static String PROP_REMARK = "remark";
	public static String PROP_URGENT_FEE = "urgentFee";
	public static String PROP_PROFESSIONAL_FEE = "professionalFee";
	public static String PROP_TYPESETTING_FEE = "typesettingFee";
	public static String PROP_PROJECT = "project";
	public static String PROP_SECOND_SIGN_DATE = "secondSignDate";
	public static String PROP_IS_VALID = "isValid";
	public static String PROP_ADVANCE_PAYMENT = "advancePayment";
	public static String PROP_FIRST_PARTY = "firstParty";
	public static String PROP_PRICE = "price";
	public static String PROP_MONEY_AMOUNT = "moneyAmount";
	public static String PROP_CODE = "code";
	public static String PROP_FISRT_SIGN_DATE = "fisrtSignDate";
	public static String PROP_NAME = "name";
	public static String PROP_ID = "id";
	public static String PROP_SECOND_PARTY = "secondParty";


	// constructors
	public BaseContract () {
		initialize();
	}

	/**
	 * Constructor for primary key
	 */
	public BaseContract (Long id) {
		this.setId(id);
		initialize();
	}

	protected void initialize () {}



	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private Long id;

	// fields
    /*合同名称*/
    /*合同名称*/
	private String name;
	
    /*合同代码*/
    /*合同代码*/
	private String code;
	
    /*甲方签订日期*/
    /*甲方签订日期*/
	private java.sql.Date fisrtSignDate;
	
    /*乙方签订日期*/
    /*乙方签订日期*/
	private java.sql.Date secondSignDate;
	
    /*翻译价格(/千字符)*/
    /*翻译价格(/千字符)*/
	private Double price;
	
    /*专业技术费*/
    /*专业技术费*/
	private Double professionalFee;
	
    /*加急费(元)*/
    /*加急费(元)*/
	private Double urgentFee;
	
    /*排版费(元)*/
    /*排版费(元)*/
	private Double typesettingFee;
	
    /*预付款(元)*/
    /*预付款(元)*/
	private Double advancePayment;
	
    /*总金额*/
    /*金额*/
	private Double moneyAmount;
	
    /*备注*/
    /*备注*/
	private String remark;
	
    /*是否生效*/
    /*是否生效*/
	private Boolean isValid;
	

	// many to one
	private Project project;
	private SysDept firstParty;
	private SysDept secondParty;



	/**
	 * Return the unique identifier of this class
     * @hibernate.id
     *  generator-class="com.justonetech.core.orm.hibernate.LongIdGenerator"
     *  column="ID"
     */
	public Long getId () {
		return id;
	}

	/**
	 * Set the unique identifier of this class
	 * @param id the new ID
	 * @deprecated
	 */
	public void setId (Long id) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}




	/**
	 * Return the value associated with the column: NAME
	 */
	public String getName () {
		return name;
	}

	/**
	 * Set the value related to the column: NAME
	 * @param name the NAME value
	 */
	public void setName (String name) {
		this.name = name;
	}


	/**
	 * Return the value associated with the column: CODE
	 */
	public String getCode () {
		return code;
	}

	/**
	 * Set the value related to the column: CODE
	 * @param code the CODE value
	 */
	public void setCode (String code) {
		this.code = code;
	}


	/**
	 * Return the value associated with the column: FISRT_SIGN_DATE
	 */
	public java.sql.Date getFisrtSignDate () {
		return fisrtSignDate;
	}

	/**
	 * Set the value related to the column: FISRT_SIGN_DATE
	 * @param fisrtSignDate the FISRT_SIGN_DATE value
	 */
	public void setFisrtSignDate (java.sql.Date fisrtSignDate) {
		this.fisrtSignDate = fisrtSignDate;
	}


	/**
	 * Return the value associated with the column: SECOND_SIGN_DATE
	 */
	public java.sql.Date getSecondSignDate () {
		return secondSignDate;
	}

	/**
	 * Set the value related to the column: SECOND_SIGN_DATE
	 * @param secondSignDate the SECOND_SIGN_DATE value
	 */
	public void setSecondSignDate (java.sql.Date secondSignDate) {
		this.secondSignDate = secondSignDate;
	}


	/**
	 * Return the value associated with the column: PRICE
	 */
	public Double getPrice () {
		return price;
	}

	/**
	 * Set the value related to the column: PRICE
	 * @param price the PRICE value
	 */
	public void setPrice (Double price) {
		this.price = price;
	}


	/**
	 * Return the value associated with the column: PROFESSIONAL_FEE
	 */
	public Double getProfessionalFee () {
		return professionalFee;
	}

	/**
	 * Set the value related to the column: PROFESSIONAL_FEE
	 * @param professionalFee the PROFESSIONAL_FEE value
	 */
	public void setProfessionalFee (Double professionalFee) {
		this.professionalFee = professionalFee;
	}


	/**
	 * Return the value associated with the column: URGENT_FEE
	 */
	public Double getUrgentFee () {
		return urgentFee;
	}

	/**
	 * Set the value related to the column: URGENT_FEE
	 * @param urgentFee the URGENT_FEE value
	 */
	public void setUrgentFee (Double urgentFee) {
		this.urgentFee = urgentFee;
	}


	/**
	 * Return the value associated with the column: TYPESETTING_FEE
	 */
	public Double getTypesettingFee () {
		return typesettingFee;
	}

	/**
	 * Set the value related to the column: TYPESETTING_FEE
	 * @param typesettingFee the TYPESETTING_FEE value
	 */
	public void setTypesettingFee (Double typesettingFee) {
		this.typesettingFee = typesettingFee;
	}


	/**
	 * Return the value associated with the column: ADVANCE_PAYMENT
	 */
	public Double getAdvancePayment () {
		return advancePayment;
	}

	/**
	 * Set the value related to the column: ADVANCE_PAYMENT
	 * @param advancePayment the ADVANCE_PAYMENT value
	 */
	public void setAdvancePayment (Double advancePayment) {
		this.advancePayment = advancePayment;
	}


	/**
	 * Return the value associated with the column: MONEY_AMOUNT
	 */
	public Double getMoneyAmount () {
		return moneyAmount;
	}

	/**
	 * Set the value related to the column: MONEY_AMOUNT
	 * @param moneyAmount the MONEY_AMOUNT value
	 */
	public void setMoneyAmount (Double moneyAmount) {
		this.moneyAmount = moneyAmount;
	}


	/**
	 * Return the value associated with the column: REMARK
	 */
	public String getRemark () {
		return remark;
	}

	/**
	 * Set the value related to the column: REMARK
	 * @param remark the REMARK value
	 */
	public void setRemark (String remark) {
		this.remark = remark;
	}


    public Boolean getIsValid() {
        return isValid;
    }

    public void setIsValid(Boolean valid) {
        isValid = valid;
    }

    /**
	 * Return the value associated with the column: PROJECT_ID
	 */
	public Project getProject () {
		return project;
	}

	/**
	 * Set the value related to the column: PROJECT_ID
	 * @param project the PROJECT_ID value
	 */
	public void setProject (Project project) {
		this.project = project;
	}


	/**
	 * Return the value associated with the column: FIRST_PARTY
	 */
	public SysDept getFirstParty () {
		return firstParty;
	}

	/**
	 * Set the value related to the column: FIRST_PARTY
	 * @param firstParty the FIRST_PARTY value
	 */
	public void setFirstParty (SysDept firstParty) {
		this.firstParty = firstParty;
	}


	/**
	 * Return the value associated with the column: SECOND_PARTY
	 */
	public SysDept getSecondParty () {
		return secondParty;
	}

	/**
	 * Set the value related to the column: SECOND_PARTY
	 * @param secondParty the SECOND_PARTY value
	 */
	public void setSecondParty (SysDept secondParty) {
		this.secondParty = secondParty;
	}



	public boolean equals (Object obj) {
		if (null == obj) return false;
		if (!(obj instanceof Contract)) return false;
		else {
			Contract contract = (Contract) obj;
			if (null == this.getId() || null == contract.getId()) return false;
			else return (this.getId().equals(contract.getId()));
		}
	}

	public int hashCode () {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId()) return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}


	public String toString () {
		ToStringBuilder builder = new ToStringBuilder(this);
		builder.append(id);
		builder.append(name);
		builder.append(code);
		builder.append(fisrtSignDate);
		builder.append(secondSignDate);
		builder.append(price);
		builder.append(professionalFee);
		builder.append(urgentFee);
		builder.append(typesettingFee);
		builder.append(advancePayment);
		builder.append(moneyAmount);
		builder.append(remark);
		builder.append(isValid);
		return builder.toString();
	}


}